package com.ccrego.haiyi.db;

import android.content.Context;

/**
 * Description:
 * Created by Andy Hong on 10/17/2017.
 */

public class DbConstant {
    public static final String PUSH_MESSAGE_DATABASE_NAME = "pushMessage.db";
    private static DaoSession pushMessageDaoSession;

    /**
     * 获取推送消息数据库会话
     *
     * @param context application context
     * @return
     */
    public static DaoSession getPushMessageDaoSession(Context context) {
        if (pushMessageDaoSession == null) {
            DaoMaster.OpenHelper helper = new DaoMaster.DevOpenHelper(context.getApplicationContext(), DbConstant.PUSH_MESSAGE_DATABASE_NAME, null);
            DaoMaster daoMaster = new DaoMaster(helper.getWritableDatabase());
            pushMessageDaoSession = daoMaster.newSession();
        }
        return pushMessageDaoSession;
    }

}
